<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>Hui</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta property="og:type" content="website">
<meta property="og:title" content="Hui">
<meta property="og:url" content="http://mhuihui.oschina.io/m-pages/page/2/index.html">
<meta property="og:site_name" content="Hui">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Hui">
  
    <link rel="alternate" href="/atom.xml" title="Hui" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/m-pages/css/style.css">
  

</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/m-pages/" id="logo">Hui</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/m-pages/">Home</a>
        
          <a class="main-nav-link" href="/m-pages/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="RSS Feed"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Search"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://mhuihui.oschina.io/m-pages"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main">
  
    <article id="post-设计模式" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/m-pages/2017/01/09/设计模式/" class="article-date">
  <time datetime="2017-01-09T12:22:29.000Z" itemprop="datePublished">2017-01-09</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/m-pages/2017/01/09/设计模式/">设计模式</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="工厂模式"><a href="#工厂模式" class="headerlink" title="工厂模式:"></a>工厂模式:</h2><blockquote>
<p>有三个角色，分别是工厂、抽象产品、具体产品,通过工厂产生具体产品，返回抽象产品。<br>当加入新的产品，当增加一个产品不用修改客户端，如果用了返射，工厂也不需要修改，只需修改配置文件,提高代的可扩展、可维护性。</p>
<p>工厂与new的比较:<br><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">		Product user=<span class="keyword">new</span> ConcreteProduct1();</div><div class="line">Product p1=Factory.newInstance();</div></pre></td></tr></table></figure></p>
</blockquote>
<h2 id="单例模式"><a href="#单例模式" class="headerlink" title="单例模式:"></a>单例模式:</h2><p>整个jvm中只有一个实例</p>
<p>1、饿汉式<br>    public class Singleton<br>    {<br>        private static Singletom me;<br>        private Singleton()<br>        {<br>        }<br>        public static Singleton newInstance()<br>        {<br>            if(me==null)<br>            {<br>                me=new Singleton();<br>            }<br>            return me;<br>        }<br>    }<br>    2、懒汉式<br>    public class Singleton<br>    {<br>        private static Singletom me=new Singlton();<br>        private Singleton()<br>        {<br>        }<br>        public static Singleton newInstance()<br>        {<br>            return me;<br>        }<br>    }<br>    三个特点:<br>        1、构造子私有<br>        2、有一个私有的静态属性，类型是类本身<br>        3、有一个公有的静态方法<br>模板模式<br>    三个角色:<br>        父类:有具体方法也有抽象方法，具体方法调用子类实现的抽象方法，<br>             在调用子类实现的抽象方法之前之后，提供服务。<br>        子类:继承父类的具体方法，实现父类的抽象方法。<br>        客户端:    向客户端公开的子类，客户端调用子类继承父类的具体方法，<br>            父类具体方法调用子类实现的抽象方法。<br>    public abstract class Parent<br>    {<br>        public void service()<br>        {<br>            System.out.println(“服务1”);<br>            a1();<br>            a2();<br>            a3();<br>            System.out.println(“服务2”);</p>
<pre><code>    }
    public abstract void a1();
    public abstract void a2();
    public abstract void a3();
}
public class Child extends Parent
{

    public void a1()
    {
    }
    public void a2()
    {
    }
    public void a3()
    {
    }
}
public class Client
{
    public static void main(String[] args)
    {
        Child child=new Child();
        child.service();
    }
}
</code></pre><p>四、代理模式<br>    有三个角色，分别是通用接口、真实对象、代理，真实对象、代理<br>    实现的同一个接口，将真实对象作为代理的一个属性，向客户端公开的<br>    代理，客户端调用代理的一方法时，代到调用真实对象的方法，在调用真实<br>    对象的方法之间之后可以做一些服务。<br>五、什么是aop<br>    aop不是oop,aop是面向方面编程，是对oop的一个补充<br>    oop是纵向的业务处理，aop是横向的服务，如事务、安全、<br>    日志<br>六、aop实现的原理及名词<br>    aop实现的原理就是代理模式<br>    名词:<br>        拦载器:代理<br>        真实对象:本原<br>        装备:做具体的服务<br>        关切点:那些方法需要什么样的服务<br>        连接点:拦截拦截的是方法还是属性，一般是方法。</p>
<p>一、代理模式?<br>    代理查模式有三个角色，分别是通用接口、代理类、真实对象，<br>    代理类与真实对象实都实现的通用接口，将真实对象作为代理类的<br>    一个属性，向客户端公开的代理类，客户端调用代理类的方法，代理<br>    调用真实对象方法，在调用真实对象的方法之前之后可以做一些服务。<br>二、什么是aop?aop相关的名词是什么?<br>    aop是面向方面编程，是对oop的补充，oop主要是纵向的业务，aop主要<br>    应用横向的服务，主事务、日志、安全，不可以替代oop,只是补充。<br>    aop相关的名词:<br>        拦截器(代理):向客户端公开通过它找到真实对象。<br>        真实对象:做具体的处理。<br>        装备:代理调用服务类如TransactionManager<br>        关切点:为那些方法提供什么样的服务，如是否需要的事务。<br>        连接点:连接的是方法还是属性，一般是方法。</p>
<p>十、模式的好处是什么?<br>    提高代码的可扩展、可维护<br>十二、模式的原则?<br>    开闭原则:增加开放(可以替换已有的类)，修改关闭(但对已有类不做修改)。<br>十三、框架设计的原则?<br>    上层依赖于下层，尽量减少下层对上层的依赖，层与层之间通过<br>    接口调用。<br>十四、工厂模式<br>    有三个角色抽象产品、具体产品、工厂，工厂产生具体产品返回<br>    抽象产品。<br>    如果没有用反射，当增加一个产品时，只需修改工厂，不用修改客户端<br>        半符合开闭原则。<br>    如果用了反射，当增加一个产品时，只需修改配置文件，不用修改客户端及<br>        工厂，完全符合开闭原则。<br>十五、单例模式:整个jvm中只有一个实例，有三个特点如下:<br>    1、私有的构造子<br>    2、私有的静态属性类型是自己<br>    3、公有的静态方法<br>        1、懒汉式:在真正取时才实例化<br>             private static LazySingleton me;<br>             public static LazySingleton newInstance()<br>             {<br>                 if(me==null)<br>                 {<br>                     me =new LazySigleton();<br>                 }<br>                 return me;<br>             }<br>        2、饿汉式:在加载类时直接实例化<br>              private static HungarySingleton me=new HungarySingleton();<br>十六、模板模式:有一个抽象类定义了具体方法及抽象方法，<br>    具体方法调用抽象方法，为抽象方法提供服务。<br>    子类继承抽象类，实现抽象方法，向客户端公开的<br>    子类，通过抽象类的具体方法调用子类实现的抽象方法，<br>    子类共用父类具体方法提供的服务。</p>
<p>二、装饰模式<br>    有三个角色，分别是通用接口、本原、装饰，本原与装饰都实现了<br>    通用接口，因为将通用接口聚集到了装饰中，所以可以将本原或<br>    装饰聚集到另一个装饰中。通过构造子将一个装饰注入到另一个装饰<br>    中后，可以将多个装饰的功能随意组合，生成更强大的功能。<br>    其实用继承也是可以实现的，但多写很多类。</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://mhuihui.oschina.io/m-pages/m-pages/2017/01/09/设计模式/" data-id="ciyzazat1001bs8vghzyrzjqi" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/m-pages/tags/设计/">设计</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-IDEA注册码" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/m-pages/2017/01/09/IDEA注册码/" class="article-date">
  <time datetime="2017-01-09T12:11:38.000Z" itemprop="datePublished">2017-01-09</time>
</a>
    
  </div>
  <div class="article-inner">
    
<div class="article-gallery">
  <div class="article-gallery-photos">
    
      <a class="article-gallery-img fancybox" href="https://static.hinpc.com/image/2016/201611-ipad-605420_1920.jpg!width600" rel="gallery_ciyzazarb0001s8vg8wmwac5w">
        <img src="https://static.hinpc.com/image/2016/201611-ipad-605420_1920.jpg!width600" itemprop="image">
      </a>
    
  </div>
</div>

    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/m-pages/2017/01/09/IDEA注册码/">IDE注册码</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h2 id="IDEAi注册码"><a href="#IDEAi注册码" class="headerlink" title="IDEAi注册码"></a>IDEAi注册码</h2><h4 id="IDEA-注册"><a href="#IDEA-注册" class="headerlink" title="IDEA 注册"></a>IDEA 注册</h4><p>Idea注册：<a href="http://idea.qinxi1992.cn" target="_blank" rel="external">http://idea.qinxi1992.cn</a></p>
<p>注册码：</p>
<p><code>43B4A73YYJ-eyJsaWNlbnNlSWQiOiI0M0I0QTczWVlKIiwibGljZW5zZWVOYW1lIjoibGFuIHl1IiwiYXNzaWduZWVOYW1lIjoiIiwiYXNzaWduZWVFbWFpbCI6IiIsImxpY2Vuc2VSZXN0cmljdGlvbiI6IkZvciBlZHVjYXRpb25hbCB1c2Ugb25seSIsImNoZWNrQ29uY3VycmVudFVzZSI6ZmFsc2UsInByb2R1Y3RzIjpbeyJjb2RlIjoiSUkiLCJwYWlkVXBUbyI6IjIwMTctMDItMjUifSx7ImNvZGUiOiJBQyIsInBhaWRVcFRvIjoiMjAxNy0wMi0yNSJ9LHsiY29kZSI6IkRQTiIsInBhaWRVcFRvIjoiMjAxNy0wMi0yNSJ9LHsiY29kZSI6IlBTIiwicGFpZFVwVG8iOiIyMDE3LTAyLTI1In0seyJjb2RlIjoiRE0iLCJwYWlkVXBUbyI6IjIwMTctMDItMjUifSx7ImNvZGUiOiJDTCIsInBhaWRVcFRvIjoiMjAxNy0wMi0yNS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QLUwwa/cG++2+wNWP+HtBhVxMRNTdVhSm38AknZlD+PTAsWGu9GyLmhti2EnVwGybSD2Dxmhxk3IPCkhKAK+pl0eWYGZWG3tJ9mZ7SowcXLWDFAk0lRJnKGFMTggrWjV8GYpw5bq23VmIqqDLgkNzuoog==</code></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://mhuihui.oschina.io/m-pages/m-pages/2017/01/09/IDEA注册码/" data-id="ciyzazarb0001s8vg8wmwac5w" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/m-pages/tags/ide/">ide</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-指定启动JDK版本" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/m-pages/2017/01/09/指定启动JDK版本/" class="article-date">
  <time datetime="2017-01-09T12:11:38.000Z" itemprop="datePublished">2017-01-09</time>
</a>
    
  </div>
  <div class="article-inner">
    
<div class="article-gallery">
  <div class="article-gallery-photos">
    
      <a class="article-gallery-img fancybox" href="http://ojg32ej8x.bkt.clouddn.com/1255ccc60e57ad9c20c470b5e507bdb3.jpg" rel="gallery_ciyzazat00019s8vg3myy32tj">
        <img src="http://ojg32ej8x.bkt.clouddn.com/1255ccc60e57ad9c20c470b5e507bdb3.jpg" itemprop="image">
      </a>
    
  </div>
</div>

    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/m-pages/2017/01/09/指定启动JDK版本/">STS Eclipse IDEA 指定启动JDK版本</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<p><img src="http://ojg32ej8x.bkt.clouddn.com/1255ccc60e57ad9c20c470b5e507bdb3.jpg" alt="image"></p>
<h4 id="使用场景："><a href="#使用场景：" class="headerlink" title="使用场景："></a>使用场景：</h4><blockquote>
<p>开发人员在自己的机器上可能装了多个版本的JDK，但是在环境变量中只能配置一个 <code>JAVA_HOME</code> ，so你的<code>IDEA Eclipse</code> 可能因为你在 <code>JAVA_HOME</code> 配置JDK1.8 以下的版本而无法启动（这个问题在新版本的IDEA Eclipse 中十分常见），所以下面的方法你值得拥有。</p>
</blockquote>
<h2 id="1、STS-Eclipse-指定启动JDK版本"><a href="#1、STS-Eclipse-指定启动JDK版本" class="headerlink" title="1、STS Eclipse 指定启动JDK版本"></a>1、STS Eclipse 指定启动JDK版本</h2><ul>
<li>通过修改 <code>STS.ini</code> 或者 <code>Eclipse.ini</code> 文件第一行（必须是第一行）添加如下内容：  <figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">-vm</div><div class="line">D:/software/java/jdk1.8.0_73/bin/javaw</div></pre></td></tr></table></figure>
</li>
</ul>
<h2 id="2、IDEA-指定启动JDK版本"><a href="#2、IDEA-指定启动JDK版本" class="headerlink" title="2、IDEA 指定启动JDK版本"></a>2、IDEA 指定启动JDK版本</h2><blockquote>
<p>说明：IDEA 16 版本的64.exe 启动必须要 <code>jdk1.8</code> 环境（为什么要用64.exe呢？因为64默认内存更大，稳定性更好），但是你在<code>JAVA_HOME</code>中配置的 &lt;1.8 ,怎么解决这个问题呢？看下面：</p>
</blockquote>
<ul>
<li>在环境变量中添加 <code>IDEA_JDK</code>配置JDK1.8 ， 然后通过idea.bat文件启动IDEA，问题解决！</li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://mhuihui.oschina.io/m-pages/m-pages/2017/01/09/指定启动JDK版本/" data-id="ciyzazat00019s8vg3myy32tj" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/m-pages/tags/ide/">ide</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-Nginx 配置 文件服务器" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/m-pages/2017/01/09/Nginx 配置 文件服务器/" class="article-date">
  <time datetime="2017-01-09T12:11:38.000Z" itemprop="datePublished">2017-01-09</time>
</a>
    
  </div>
  <div class="article-inner">
    
<div class="article-gallery">
  <div class="article-gallery-photos">
    
      <a class="article-gallery-img fancybox" href="https://static.hinpc.com/image/2016/201611-ipad-605420_1920.jpg!width600" rel="gallery_ciyzazarq000as8vgzptpn94n">
        <img src="https://static.hinpc.com/image/2016/201611-ipad-605420_1920.jpg!width600" itemprop="image">
      </a>
    
  </div>
</div>

    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/m-pages/2017/01/09/Nginx 配置 文件服务器/">Nginx 配置文件服务器</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h2 id="Nginx-配置"><a href="#Nginx-配置" class="headerlink" title="Nginx 配置"></a>Nginx 配置</h2><ul>
<li>文件服务器<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line"></div><div class="line"> location /files &#123;</div><div class="line">    alias   D:\yhq\www;</div><div class="line">    allow all;</div><div class="line">    autoindex on;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
</li>
</ul>
<hr>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://mhuihui.oschina.io/m-pages/m-pages/2017/01/09/Nginx 配置 文件服务器/" data-id="ciyzazarq000as8vgzptpn94n" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/m-pages/tags/linux/">linux</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-Linux过滤通过grep" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/m-pages/2017/01/09/Linux过滤通过grep/" class="article-date">
  <time datetime="2017-01-09T12:11:38.000Z" itemprop="datePublished">2017-01-09</time>
</a>
    
  </div>
  <div class="article-inner">
    
<div class="article-gallery">
  <div class="article-gallery-photos">
    
      <a class="article-gallery-img fancybox" href="http://ojg32ej8x.bkt.clouddn.com/2017-01-09%2020:24:16%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE.png" rel="gallery_ciyzazaro0008s8vgek2gxnil">
        <img src="http://ojg32ej8x.bkt.clouddn.com/2017-01-09%2020:24:16%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE.png" itemprop="image">
      </a>
    
  </div>
</div>

    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/m-pages/2017/01/09/Linux过滤通过grep/">Linux过滤通过grep</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<p><img src="http://ojg32ej8x.bkt.clouddn.com/2017-01-09%2020:24:16%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE.png" alt="image"></p>
<h2 id="linux系统中，利用grep打印匹配的上下几行"><a href="#linux系统中，利用grep打印匹配的上下几行" class="headerlink" title="linux系统中，利用grep打印匹配的上下几行"></a>linux系统中，利用grep打印匹配的上下几行</h2><blockquote>
<p>如果在只是想匹配模式的上下几行，grep可以实现。</p>
</blockquote>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">$grep -5 &apos;parttern&apos; inputfile       //打印匹配行的前后5行</div><div class="line">$grep -C 5 &apos;parttern&apos; inputfile     //打印匹配行的前后5行</div><div class="line">$grep -A 5 &apos;parttern&apos; inputfile     //打印匹配行的后5行</div><div class="line">$grep -B 5 &apos;parttern&apos; inputfile     //打印匹配行的前5行</div></pre></td></tr></table></figure>
<p>查看mysql慢日志中ip地址为192.168.0.10发送过来的SQL语句的后面三行</p>
<p><code>tail -50 /usr/local/mysql/data/sql-slow.log |grep -3 &#39;192.168.0.10&#39;</code></p>
<blockquote>
<p>匹配php错误日志中某一个字段</p>
</blockquote>
<p><code>tail -100 /data/logs/php/php_error_5.3.log  | grep  &quot;Memcache::get()&quot;</code></p>
<p>查看某一个文件第5行和第10行 <code>sed -n &#39;5,10p&#39; filename</code> 这样你就可以只查看文件的第5行到第10行。</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://mhuihui.oschina.io/m-pages/m-pages/2017/01/09/Linux过滤通过grep/" data-id="ciyzazaro0008s8vgek2gxnil" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/m-pages/tags/linux/">linux</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-Tomcat 优化" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/m-pages/2017/01/09/Tomcat 优化/" class="article-date">
  <time datetime="2017-01-09T12:11:38.000Z" itemprop="datePublished">2017-01-09</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/m-pages/2017/01/09/Tomcat 优化/">Tomcat优化</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<h3 id="Tomcat优化"><a href="#Tomcat优化" class="headerlink" title="Tomcat优化"></a>Tomcat优化</h3><ol>
<li>中文乱码问题解决<br>如果表单是以get方式提交就会出现中文乱码<br>这时可以在tomcat中配置解决中文乱码问题。方法如下：<br>在tomcat的conf文件夹下的conf中找到server.xml文件 再端口的那个地方 <connector port="8081" protocol="HTTP/1.1" connectiontimeout="20000" redirectport="8443" uriencoding="UTF-8"></connector></li>
</ol>
<ol>
<li><p>用户角色管理</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">&lt;role rolename=&quot;admin-gui&quot;/&gt;</div><div class="line">&lt;role rolename=&quot;admin-script&quot;/&gt;</div><div class="line">&lt;role rolename=&quot;manager-gui&quot;/&gt;</div><div class="line">&lt;role rolename=&quot;manager-script&quot;/&gt;</div><div class="line">&lt;role rolename=&quot;manager-jmx&quot;/&gt;</div><div class="line">&lt;role rolename=&quot;manager-status&quot;/&gt;</div><div class="line">&lt;user username=&quot;admin&quot; password=&quot;admin&quot; roles=&quot;manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui&quot;/&gt;</div><div class="line">&lt;/tomcat-users&gt;</div></pre></td></tr></table></figure>
</li>
<li><p>内存优化<br>在tomcat运行环境中设置：<br>window环境 startup.bat第一行</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">SET CATALINA_OPTS= -Xms256m -Xmx512m -XX:MaxNewSize=256m -XX:MaxPermSize=256m</div></pre></td></tr></table></figure>
</li>
</ol>
<p>linux环境在catalina.sh<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">&quot;if [ $have_tty -eq 1 ]; then&quot;</div></pre></td></tr></table></figure></p>
<p>之后增加</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">JAVA_OPTS=&quot;-server -Xms256m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m&quot;</div></pre></td></tr></table></figure>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://mhuihui.oschina.io/m-pages/m-pages/2017/01/09/Tomcat 优化/" data-id="ciyzazas4000ls8vgwvetc3g3" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/m-pages/tags/编程/">编程</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-带有图片的标题" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/m-pages/2017/01/09/带有图片的标题/" class="article-date">
  <time datetime="2017-01-09T12:11:38.000Z" itemprop="datePublished">2017-01-09</time>
</a>
    
  </div>
  <div class="article-inner">
    
<div class="article-gallery">
  <div class="article-gallery-photos">
    
      <a class="article-gallery-img fancybox" href="https://static.hinpc.com/image/2016/201611-ipad-605420_1920.jpg!width600" rel="gallery_ciyzazasv0017s8vgeor0ot5z">
        <img src="https://static.hinpc.com/image/2016/201611-ipad-605420_1920.jpg!width600" itemprop="image">
      </a>
    
  </div>
</div>

    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/m-pages/2017/01/09/带有图片的标题/">带有图片的标题</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://mhuihui.oschina.io/m-pages/m-pages/2017/01/09/带有图片的标题/" data-id="ciyzazasv0017s8vgeor0ot5z" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/m-pages/tags/编程/">编程</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-linux软链接的创建" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/m-pages/2017/01/09/linux软链接的创建/" class="article-date">
  <time datetime="2017-01-09T12:11:38.000Z" itemprop="datePublished">2017-01-09</time>
</a>
    
  </div>
  <div class="article-inner">
    
<div class="article-gallery">
  <div class="article-gallery-photos">
    
      <a class="article-gallery-img fancybox" href="http://ojg32ej8x.bkt.clouddn.com/2b9a0d00dadeb5a5379850e79613bbc8.jpg" rel="gallery_ciyzazasn0013s8vg7x4dh9uh">
        <img src="http://ojg32ej8x.bkt.clouddn.com/2b9a0d00dadeb5a5379850e79613bbc8.jpg" itemprop="image">
      </a>
    
  </div>
</div>

    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/m-pages/2017/01/09/linux软链接的创建/">linux软链接的创建</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<p><img src="http://ojg32ej8x.bkt.clouddn.com/2b9a0d00dadeb5a5379850e79613bbc8.jpg" alt="image"></p>
<h3 id="1、软链接的创建以及说明"><a href="#1、软链接的创建以及说明" class="headerlink" title="1、软链接的创建以及说明"></a>1、软链接的创建以及说明</h3><blockquote>
<p>linux 软链接相当于window系统下的快捷方式</p>
<p>软链接只有放在 <code>/usr/local/bin</code> 下面才能够在任何地方通过命令调用</p>
<p>软链接创建的方式 <code>ln -s -f /opt/node/npm /usr/local/bin/npm</code> ， <code>-f</code> 表示已经存在软链接则强制覆盖</p>
</blockquote>
<h3 id="2、创建软链接时可能出现的问题"><a href="#2、创建软链接时可能出现的问题" class="headerlink" title="2、创建软链接时可能出现的问题"></a>2、创建软链接时可能出现的问题</h3><ul>
<li>错误 </li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">ln: failed to access &quot;/usr/local/bin/cordova&quot;: 符号连接的层数过多</div></pre></td></tr></table></figure>
<ul>
<li>解决方案一：</li>
</ul>
<blockquote>
<p>路径写绝对地址，不要写相对地址</p>
</blockquote>
<ul>
<li>解决方案二：</li>
</ul>
<blockquote>
<p>方法一还是不能解决，就先在 <code>/usr</code> 路径下面创建软连接，然后将生成的软链接复制到 <code>/usr/local/bin/</code></p>
</blockquote>
<p>到此问题解决完了，这也是我遇到的问题，记录下来可行的解决方案，希望能够帮助到跟多的人～</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://mhuihui.oschina.io/m-pages/m-pages/2017/01/09/linux软链接的创建/" data-id="ciyzazasn0013s8vg7x4dh9uh" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/m-pages/tags/linux/">linux</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-使用模板搭建git pages 博客" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/m-pages/2017/01/09/使用模板搭建git pages 博客/" class="article-date">
  <time datetime="2017-01-09T12:11:38.000Z" itemprop="datePublished">2017-01-09</time>
</a>
    
  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/m-pages/2017/01/09/使用模板搭建git pages 博客/">使用模板搭建git pages 博客</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <hr>
<p><img src="http://ojg32ej8x.bkt.clouddn.com/hexo.jpg" alt="image"><br>Welcome to <a href="https://hexo.io/" target="_blank" rel="external">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/" target="_blank" rel="external">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html" target="_blank" rel="external">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues" target="_blank" rel="external">GitHub</a>.</p>
<h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo new <span class="string">"My New Post"</span></div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="external">Writing</a></p>
<h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo server</div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="external">Server</a></p>
<h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo generate</div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/generating.html" target="_blank" rel="external">Generating</a></p>
<h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ hexo deploy</div></pre></td></tr></table></figure>
<p>More info: <a href="https://hexo.io/docs/deployment.html" target="_blank" rel="external">Deployment</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://mhuihui.oschina.io/m-pages/m-pages/2017/01/09/使用模板搭建git pages 博客/" data-id="ciyzazass0015s8vgj09njuk1" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/m-pages/tags/编程/">编程</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-docker安装教程" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/m-pages/2017/01/08/docker安装教程/" class="article-date">
  <time datetime="2017-01-08T04:43:09.000Z" itemprop="datePublished">2017-01-08</time>
</a>
    
  </div>
  <div class="article-inner">
    
<div class="article-gallery">
  <div class="article-gallery-photos">
    
      <a class="article-gallery-img fancybox" href="http://ojg32ej8x.bkt.clouddn.com/c8dbf0ab34b4c39ccce67bee9bac9846.png?imageslim" rel="gallery_ciyzazas7000ns8vgntpwapuw">
        <img src="http://ojg32ej8x.bkt.clouddn.com/c8dbf0ab34b4c39ccce67bee9bac9846.png?imageslim" itemprop="image">
      </a>
    
  </div>
</div>

    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/m-pages/2017/01/08/docker安装教程/">docker安装教程</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p><img src="http://ojg32ej8x.bkt.clouddn.com/c8dbf0ab34b4c39ccce67bee9bac9846.png?imageslim" alt="image"></p>
<ul>
<li>准备Linux 机器，保证能够上网</li>
<li>升级Linux内核，centos6.5以上不需要升级</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm</div><div class="line">yum update -y</div></pre></td></tr></table></figure>
<ul>
<li>安装docker</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div></pre></td><td class="code"><pre><div class="line">安装稳定版</div><div class="line">curl -sSL https://get.daocloud.io/docker | sh</div><div class="line"></div><div class="line">安装最新版</div><div class="line">curl -sSL https://get.daocloud.io/docker-experimental | sh</div><div class="line"></div><div class="line">配置docker加速器</div><div class="line">curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://beedb3ca.m.daocloud.io</div><div class="line"></div><div class="line">安装完成，查看版本</div><div class="line"></div><div class="line">docker version </div><div class="line">If you would like to use Docker as a non-root user, you should now consider</div><div class="line">adding your user to the &quot;docker&quot; group with something like:</div><div class="line">sudo usermod -aG docker yhq</div><div class="line">```  </div><div class="line"></div><div class="line">&gt; 内核安装成功之后重启的时候默认使用新内核，无法启动，选择原来的内核启动</div><div class="line"></div><div class="line">#### 安装docker-compose</div><div class="line"></div><div class="line">- 下载到合适的位置</div></pre></td></tr></table></figure>
<p>curl -L <a href="https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname" target="_blank" rel="external">https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname</a> -s<code>-</code>uname -m` &gt; /usr/local/bin/docker-compose<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"></div><div class="line">- 赋予执行权限</div></pre></td></tr></table></figure></p>
<p>$ chmod +x /usr/local/bin/docker-compose<br>```</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://mhuihui.oschina.io/m-pages/m-pages/2017/01/08/docker安装教程/" data-id="ciyzazas7000ns8vgntpwapuw" class="article-share-link">Share</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/m-pages/tags/linux/">linux</a></li></ul>

    </footer>
  </div>
  
</article>


  


  <nav id="page-nav">
    <a class="extend prev" rel="prev" href="/m-pages/">&laquo; __('prev')</a><a class="page-number" href="/m-pages/">1</a><span class="page-number current">2</span><a class="page-number" href="/m-pages/page/3/">3</a><a class="extend next" rel="next" href="/m-pages/page/3/">__('next') &raquo;</a>
  </nav>
</section>
        
          <aside id="sidebar">
  
    

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tags</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/m-pages/tags/ide/">ide</a></li><li class="tag-list-item"><a class="tag-list-link" href="/m-pages/tags/linux/">linux</a></li><li class="tag-list-item"><a class="tag-list-link" href="/m-pages/tags/编程/">编程</a></li><li class="tag-list-item"><a class="tag-list-link" href="/m-pages/tags/设计/">设计</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Tag Cloud</h3>
    <div class="widget tagcloud">
      <a href="/m-pages/tags/ide/" style="font-size: 13.33px;">ide</a> <a href="/m-pages/tags/linux/" style="font-size: 16.67px;">linux</a> <a href="/m-pages/tags/编程/" style="font-size: 20px;">编程</a> <a href="/m-pages/tags/设计/" style="font-size: 10px;">设计</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/m-pages/archives/2017/02/">February 2017</a></li><li class="archive-list-item"><a class="archive-list-link" href="/m-pages/archives/2017/01/">January 2017</a></li><li class="archive-list-item"><a class="archive-list-link" href="/m-pages/archives/2016/12/">December 2016</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Recent Posts</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/m-pages/2017/02/10/go语言学习笔记（四)/">go语言学习笔记（四）</a>
          </li>
        
          <li>
            <a href="/m-pages/2017/02/10/hello-world/">Hello World</a>
          </li>
        
          <li>
            <a href="/m-pages/2017/01/14/go语言学习笔记（三）/">go语言学习笔记（三）</a>
          </li>
        
          <li>
            <a href="/m-pages/2017/01/13/go语言学习笔记（二）/">go语言学习笔记（二）结构体和切片</a>
          </li>
        
          <li>
            <a href="/m-pages/2017/01/12/go语言学习笔记（一）/">go语言开发环境搭建</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2017 hui<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/m-pages/" class="mobile-nav-link">Home</a>
  
    <a href="/m-pages/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/m-pages/fancybox/jquery.fancybox.css">
  <script src="/m-pages/fancybox/jquery.fancybox.pack.js"></script>


<script src="/m-pages/js/script.js"></script>

  </div>
</body>
</html>